//
//  UserCredit.m
//  yuimall_Iphone
//
//  Created by yuike6 yuike6 on 12-4-17.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "UserCredit.h"
#import "header.h"

@implementation UserCredit

@synthesize level;
@synthesize score;

@synthesize total_num;
@synthesize good_num;

- (void) dealloc
{
    YRelease(level)
    YRelease(score)
    
    YRelease(total_num)
    YRelease(good_num)
    
    [super dealloc];
}


-(void) privateInit
{
    NSString * rootName = [[self.xmlTree root] name];
    self.level = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:[NSString stringWithFormat:@"%@/%@", rootName, @"level"]] doubleValue]];
    
    self.score = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:[NSString stringWithFormat:@"%@/%@", rootName, @"score"]] doubleValue]];
    
    self.total_num = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:[NSString stringWithFormat:@"%@/%@", rootName, @"total_num"]] doubleValue]];
    
    self.good_num = [NSNumber numberWithDouble:[[self.xmlTree valueAtPath:[NSString stringWithFormat:@"%@/%@", rootName, @"good_num"]] doubleValue]];
    
}

-(id) initWithXmlTree:(XMLParsedTree *)tree
{
    self = [super initWithXmlTree:tree];
    if (self) {
        [self privateInit];
    }
    
    return self;
}


-(id) initWithXmlString:(NSString *)xmlString
{
    self = [super initWithXmlString:xmlString];
    if (self) {
        [self privateInit];
    }
    return self;
}

-(id) initWithXmlData:(NSData *)xmlData
{
    self = [super initWithXmlData:xmlData];
    if (self) {
        [self privateInit];
    }
    return self;
}
@end
